package com.kaifamiao.month04.day19;

import java.util.*;

public class Demo {

    public static void main(String[] args) {
//        Map map = Map.of(1, "123", 2, "234");
//        Set set =  map.entrySet();
//        for (Object s : set) {
//            Map.Entry entry = (Map.Entry)s;
//            System.out.println(entry.getKey());
//        }

        LinkedList linkedList = new LinkedList();
        TreeMap treeMap = new TreeMap();
        HashMap map = new HashMap();
        HashSet ss = new HashSet();
//        treeMap.
        treeMap.put(1, "aaa");
        treeMap.put(2, "bbb");
        treeMap.put(3, "ccc");
        treeMap.put(4, "ddd");
//        System.out.println(treeMap.put("123", "xxx"));
        System.out.println(treeMap.lowerEntry(3));
        System.out.println(treeMap.lowerKey(3));

//        System.out.println(new Integer(2) + new Character('1')) ;
        for (Object key : treeMap.keySet()) {
            System.out.println(key.toString() + treeMap.get(key) + "");
        }

        Set set = treeMap.entrySet();
        for (Object s : set) {
            Map.Entry entry = (Map.Entry)s;
            System.out.println(entry.getKey() + "" + entry.getValue());
            System.out.println("" + entry.getKey() + entry.getValue());
            System.out.println(entry.getKey().toString() + entry.getValue());
//            System.out.println(entry.getKey() + entry.getValue() + "");   // error Object 与 Object 不能直接进行加法运算

        }

        for (Object obj : treeMap.values()) {
            String value = (String)obj;
            System.out.println(value);
        }
    }
}
